package cn.edu.dlut.port.isp.bean.teach;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;

/**
 * Created by liningning on 2018/4/25.
 */
@Entity
@Table(name="teach_berth")
public class BerthBean {

        /**
         * cargoTypeID : 2
         * cargoType : 进口散货
         * tonnage : 35000
         * number : 1
         */
	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
		private int berthid;
        private int cargoTypeID;
        private int tonnage;
        private int number;
        private int portid;
        
    	@OneToOne
    	@JoinColumn(name = "cargoTypeID", referencedColumnName = "cargoTypeID", insertable = false, updatable = false)
    	private  CargoType cargoType= new CargoType();
    	public CargoType getCargoType() {
    		return cargoType;
    	}

        public void setCargoType(CargoType cargoType) {
			this.cargoType = cargoType;
		}


		public int getBerthid() {
			return berthid;
		}

		public void setBerthid(int berthid) {
			this.berthid = berthid;
		}

		public int getPortid() {
			return portid;
		}

		public void setPortid(int portid) {
			this.portid = portid;
		}

		public int getCargoTypeID() {
            return cargoTypeID;
        }

        public void setCargoTypeID(int cargoTypeID) {
            this.cargoTypeID = cargoTypeID;
        }

        public int getTonnage() {
            return tonnage;
        }

        public void setTonnage(int tonnage) {
            this.tonnage = tonnage;
        }

        public int getNumber() {
            return number;
        }

        public void setNumber(int number) {
            this.number = number;
        }
        
        public cn.edu.dlut.port.isp.bean.teach.simulation.BerthBean changeToSim(BerthBean b1)
        {
        	cn.edu.dlut.port.isp.bean.teach.simulation.BerthBean b2=new cn.edu.dlut.port.isp.bean.teach.simulation.BerthBean();
        	b2.setCargoTypeInt(b1.cargoTypeID);
        	b2.setCargoType(b1.getCargoType().getCargoType());
        	b2.setNumber(b1.getNumber());
        	b2.setTonnage(b1.getTonnage());
        	return b2;
        	
        }

		@Override
		public String toString() {
			return "BerthBean [berthid=" + berthid + ", cargoTypeID=" + cargoTypeID + ", tonnage=" + tonnage
					+ ", number=" + number + ", portid=" + portid + ", cargoType=" + cargoType + "]";
		}
        
        
}
